package com.ruoyi.repay.mapper;

import com.alipay.api.domain.PageInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.repay.domain.RepaymentDetails;
import com.ruoyi.repay.domain.RepaymentPlan;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface RepaymentDetailsMapper extends BaseMapper<RepaymentDetails> {
    @Select("select * from repayment_details where check_code=#{checkCode}")
    List<RepaymentDetails> repaymentDetailsList(String checkCode);
//查询还款信息
    @Select("select * from repayment_details where id=#{id} ")
    RepaymentDetails selectById(Integer id);
//添加还款订单编号
    @Update("update repayment_details set out_trade_no=#{outTradeNo} where id=#{id} ")
    void updateByIds(RepaymentDetails repaymentDetails);
//
    @Insert("insert into repayment_details(car_name,price,time,repayment_date,type,check_code,repay_status,out_trade_no) values(#{carName},#{price},#{time},#{repaymentDate},#{type},#{checkCode},#{repayStatus},#{outTradeNo})")
    void addrepaymentDetails(RepaymentDetails repaymentDetails);

    @Update("update repayment_details set repay_status=#{status} where out_trade_no=#{out}")
    void update(@Param("out")String outTradeNo, @Param("status") Integer repayStatus);
//    根据id查询还款明细
    @Select("select * from repayment_details where out_trade_no=#{outTradeNo}")
    RepaymentDetails select(String outTradeNo);
    @Update("update repayment_details set repayment_date=#{repaymentDate} where out_trade_no=#{outTradeNo}")
    void updates(RepaymentDetails repaymentDetails);

//    @Update("update repayment_details set repay_status=#{repayStatus} where out_trade_no=#{outNo}")
//    void update(@Param("outNo") String outTradeNo, @Param("status") Integer types);
}
